package simulation;

import java.util.Scanner;
import forces.CenterOfMassForce;
import forces.Gravity;
import forces.Viscosity;
import forces.WallRepulsion;


/**
 * This factory loads in forces.
 * 
 */
public class ForceFactory extends Factory {
    private static final String GRAVITY_KEYWORD = "gravity";
    private static final String VISCOSITY_KEYWORD = "viscosity";
    private static final String COM_KEYWORD = "centermass";
    private static final String WALL_REPULSION_KEYWORD = "wall";

    /**
     * Adds the appropriate force to the model.
     */
    @Override
    protected void loadObjects (Model model, Scanner line, String type) {
        if (GRAVITY_KEYWORD.equals(type)) {
            model.add(new Gravity(line));
        }
        else if (VISCOSITY_KEYWORD.equals(type)) {
            model.add(new Viscosity(line));
        }
        else if (WALL_REPULSION_KEYWORD.equals(type)) {
            model.add(new WallRepulsion(line));
        }
        else if (COM_KEYWORD.equals(type)) {
            model.add(new CenterOfMassForce(line));
        }
    }

}
